package com.xuecheng.learning.feignclient;

import com.xuecheng.content.model.po.CoursePublish;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CoursePublishClientFactory
        implements FallbackFactory<CoursePublishClient> {
    @Override
    public CoursePublishClient create(Throwable throwable) {
        return new CoursePublishClient() {
            @Override
            public CoursePublish getCoursePublish(Long courseId) {
                log.error("调用内容管理服务查询课程发布信息发生熔断：{}",throwable.toString(),throwable);
                return null;
            }
        };
    }
}
